package tree.test101;

import listbyorder.utils.TreeNode;

/**
 * @author code_yc
 * @version 1.0
 * @date 2020/7/16 11:07
 */
public class Solution1 {

    public boolean isSymmetric(TreeNode root) {
        return dfs(root, root);
    }

    private boolean dfs(TreeNode r, TreeNode t) {
        if (r == null && t == null) return true;
        if (r == null || t == null || r.val != t.val) return false;
        return dfs(r.left, t.right) && dfs(r.right, t.left);
    }
}
